//
//
//
//
//
// Properties.C
// 2011/08/29 @CieNET

#include "Properties.h"

#include "Exception.h"

namespace TinyXML
{
	Properties::Properties(){};

	Properties::Properties(const PropertyPair& pair)
	{
		_pairs.push_back(pair);
	}

	Properties::Properties(std::string& name, std::string& context)
	{
		PropertyPair pair(name, context);
		_pairs.push_back(pair);
	}

	Properties::~Properties()
	{}

	void Properties::Add(const std::string& name, const std::string& context)
	{
		 PropertyPair pair(name, context);
		  _pairs.push_back(pair);
	}

	void Properties::Clr(void)
	{
		_pairs.clear();
	}

	std::string Properties::GetProperty(const std::string& name) const
	{
		std::vector<PropertyPair>::const_iterator it = _pairs.begin();
		for(; it != _pairs.end(); ++it)
		{
			if((*it).first == name)
				return (*it).second;
		}
		throw Exception("Property NOT FOUND");
	}
};
